import select


class Select(object):

    @staticmethod
    def select(rseq, wseq, eseq, timeout):
        r, w, e = select.select(rseq, wseq, eseq, timeout)
        if isinstance(rseq, dict):
            r = dict((fd, rseq[fd]) for fd in r)
        if isinstance(wseq, dict):
            w = dict((fd, wseq[fd]) for fd in w)
        if isinstance(eseq, dict):
            e = dict((fd, eseq[fd]) for fd in e)
        return r, w, e
